/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package promogui;

import javax.swing.table.AbstractTableModel;

/**
 *
 * @author Cryptkeeper
 */
public final class TotalDeltaInputTableModel extends AbstractTableModel implements IInputTableModel
{
    private Project project;
    private RowHeaderListModel headerModel;
    
    public TotalDeltaInputTableModel(Project project)
    {
        this.project = project;       
        headerModel = new RowHeaderListModel(getRowCount());
    }
    
    public RowHeaderListModel getRowHeaderModel()
    {
        return headerModel;
    }
    
    @Override
    public int getRowCount() 
    {
        return project.getCurrentWeek();
    }

    @Override
    public int getColumnCount() 
    {
        return 5;
    }

    public void insertWeek()
    {

    }
    
    @Override
    public boolean isCellEditable(int row, int col) {return isEditabe();}
    
    @Override
    public Object getValueAt(int rowIndex, int columnIndex) 
    {
        /*
        if ( rowIndex + 1 > project.getCurrentWeek() )
        {
           return new Float(0.0);
        }
         */
        
        WeeklyProjectData data = project.getTotalWeeklyProjectData(rowIndex + 1);
        
        switch (columnIndex)
        {
            case 0: return new Float(data.getTotalRE());
            case 1: return new Float(data.getTotalAD());
            case 2: return new Float(data.getTotalII());
            case 3: return new Float(data.getTotalBT());
            case 4: return new Float(data.getTotalPM());
        }
        
        return null;
    }
    
    @Override
    public void setValueAt(Object value, int rowIndex, int columnIndex)
    {   

    }
    
    public String getColumnName(int column)
    {
        switch (column)
        {
            case 0: return "Requirement Engineering";
            case 1: return "Architecture and Design";
            case 2: return "Implementation and Integration";
            case 3: return "Build and Testing";
            case 4: return "Project Management";
        }
        
        return "";
    }
    
    public void removeLastWeek()
    {

    }

    @Override
    public boolean isEditabe() 
    {
        return false;
    }
    
}
